/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import BUSServices.QLNSBUSWebService;
import BUSServices.QLNSBUSWebService_Service;
import BUSServices.Sach;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;

/**
 *
 * @author USER
 */
public class XemThongTinSach extends ActionSupport implements ServletRequestAware, SessionAware{

    QLNSBUSWebService_Service service;
    QLNSBUSWebService port;
    private HttpServletRequest request;
    private Map session;
    private Sach s = new Sach();
    private List<Sach> listSach;
    
    public XemThongTinSach(){
        service = new QLNSBUSWebService_Service();
        port = service.getQLNSBUSWebServicePort();
    }
    
    @Override
    public void setServletRequest(HttpServletRequest hsr) {
       this.request = hsr;
    }

    @Override
    public void setSession(Map<String, Object> map) {
         this.session = map;
    }
    
    public String laySachTheoMa(){
        int maSach = Integer.parseInt(request.getParameter("maSach"));
        s = port.laySachTheoMaSach(maSach);
        listSach = port.laySachTheoTheLoaiSach(s.getMaTheLoai());
        return SUCCESS;
    }

    public Sach getS() {
        return s;
    }

    public List<Sach> getListSach() {
        return listSach;
    }
    
    
    
}
